package com.bawei.wyg.mycommerce.databinding;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.bawei.wyg.mycommerce.R;
import com.bawei.wyg.mycommerce.databinding.bind.BindActivity;
import com.bawei.wyg.mycommerce.databinding.far.BindFragmentActivity;
import com.bawei.wyg.mycommerce.databinding.nor.BasicActivity;
import com.bawei.wyg.mycommerce.databinding.rec.RecleMainActivity;
import com.bawei.wyg.mycommerce.databinding.single.SingleActivity;
import com.bawei.wyg.mycommerce.homework.one.HomeWorkActivity;
import com.bawei.wyg.mycommerce.homework.two.HomeWorkDataActivity;

public class DataBindingMainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button bind1;
    private Button bind2;
    private Button bind3;
    private Button bind4;
    private Button bind5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data_binding_main);
        initView();
        findViewById(R.id.bind1).setOnClickListener(this);
        findViewById(R.id.bind2).setOnClickListener(this);
        findViewById(R.id.bind3).setOnClickListener(this);
        findViewById(R.id.bind4).setOnClickListener(this);
        findViewById(R.id.bind5).setOnClickListener(this);
        findViewById(R.id.homeone).setOnClickListener(this);
        findViewById(R.id.hometwo).setOnClickListener(this);
        findViewById(R.id.homethree).setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch(id){
            case R.id.bind1:
                startActivity(new Intent(this, BasicActivity.class));
                break;
            case R.id.bind2:
                startActivity(new Intent(this, SingleActivity.class));
                break;
            case R.id.bind3:
                startActivity(new Intent(this, BindActivity.class));
                break;
            case R.id.bind4:
                startActivity(new Intent(this, BindFragmentActivity.class));
                break;
            case R.id.bind5:
                startActivity(new Intent(this, RecleMainActivity.class));
                break;
            case R.id.homeone:
                startActivity(new Intent(this, HomeWorkActivity.class));
                break;
            case R.id.hometwo:
                startActivity(new Intent(this, HomeWorkDataActivity.class));

                break;
            case R.id.homethree:

                break;
        }
    }

    private void initView() {
        bind1 = (Button) findViewById(R.id.bind1);
        bind2 = (Button) findViewById(R.id.bind2);
        bind3 = (Button) findViewById(R.id.bind3);
        bind4 = (Button) findViewById(R.id.bind4);
        bind5 = (Button) findViewById(R.id.bind5);
    }
}